﻿<cfsilent>
	<cfscript>
		
		dictAdvice = getProperty("serviceFactory").getBean("senateDictionaryAdvice");
		mathAdvice = getProperty("serviceFactory").getBean("senateMathAdvice");
		
		termId = event.getArg("TermID");
		academicYear = event.getArg("AcademicYear");
		academicTerm = event.getArg("AcademicTerm");
		yearTerm = event.getArg("YearTerm");
		
		
		passArgs = structNew();
		structInsert( passArgs, "TID", termId );
		
		event.setArg("pageTitle", "教学运行管理 - 排课 - 打印行政班课表");
		
		/* 目标班级信息 */
		grade_t = event.getArg("GRD", yearTerm);
		
		
		rs_grade = queryNew("grade");
		rs_subject = queryNew("sbj_id");
		rs_gradeSBJ = queryNew("grade");
		rs_clazz = queryNew("cls_id");


	    
	    currentTab = event.getArg("TabID", "labFormClass");
	    
	    /*读取所有年级信息*/
	     sql = "	SELECT
				    clz.grade
			    FROM
				    t_class clz
			   group by clz.grade
			    ORDER BY
				    clz.grade desc ";
	    
	    queryObj = new Query(datasource = application.dnsSlave);
	    rs_grade = queryObj.execute(sql = sql).getResult();
    
	    
	    /*  读取班级信息 */
	    
	    sql = "	SELECT
				    clz.cls_id,clz.cls_name,clz.cls_size,clz.cls_scale,c.campus_name, clz.grade 
			    FROM
				    t_class clz
				    INNER JOIN t_campus c ON c.campus_id = clz.campus_id
			    WHERE
				     clz.grade = :grade 
			    ORDER BY
				    clz.cls_name";
	    
	    queryObj = new Query(datasource = application.dnsSlave);
	    queryObj.addParam(name = "grade", value = grade_t, cfsqltype = "cf_sql_char");
	    rs_clazz = queryObj.execute(sql = sql).getResult();
	
							
	</cfscript>
</cfsilent>

<div id="headArea">
	<div class="uiHeader uiHeaderWithImage ptm">
		<div class="clearfix uiHeaderTop">
			<div class="uiHeaderActions rfloat">
				<a class="uiButton" href="<cfoutput>#buildURL('teacherArrange', passArgs)#</cfoutput>"><i class="mrs img btnList"></i><span class="uiButtonText">教师上课情况汇总</span></a>
			</div>
			<div>
				<h2 class="uiHeaderTitle">
					<i class="uiHeaderImage img icon16x16 collection"></i>学期行政班授课安排情况
				</h2>
			</div>
		</div>
	</div>
</div>

<div class="UIElement">
	<ul class="senateFirstPage">
		<li>
			<div class="clearfix" id="courseTable">
			
				<cfif termId eq "">
					<!-- termSelector -->
					<cfoutput>#event.getArg("termSelector")#</cfoutput>
					<!-- /termSelector -->
				</cfif>
			
				<cfif len(termId)>
					
					<div class="UItab">
						<div class="tabLables"> 
							<span <cfif currentTab eq "labFormClass">class="active"</cfif> id="labFormClass" tabTarget="FormClass">选择行政班</span>
							
						</div>
					</div>
					
					<script language="javascript" type="text/javascript">
						//<![CDATA[
						<!--
						$(document).ready(function() {
					
							/* init Tab */
							$("div.tabContent").hide();
							$("div#" + $("div.tabLables span.active").attr("tabTarget")).show();
						
							$("div.tabLables > span").click(function(){
								var $targetID = $(this).attr("tabTarget");
								
								$("div.tabLables span").removeClass("active");
								$(this).addClass("active");
							
								$("div.tabContent").not('[id="' + $targetID + '"]').hide();
								$("div.tabContent#" + $targetID).show();
							});
						
						});
					
						// -->
						//]]>
					</script>
                         
					<div id="FormClass" class="tabContent">
                          
                               <div class="noticeBlock">
                                    <div class="operation">
                                         <cfloop query="rs_grade">
                                              <cfset structInsert(passArgs, "GRD", rs_grade.grade, true) />
                                          
                                              <a class="uiButton <cfif rs_grade.grade eq grade_t>uiButtonSpecial</cfif>" href="<cfoutput>#buildURL('classCourseTable', passArgs)#</cfoutput>"><span class="uiButtonText"><cfoutput>#rs_grade.grade#</cfoutput> 级</span></a>
                                         </cfloop>
                                         
                                         <cfset structDelete( passArgs, "GRD", false ) />
                                    </div>
                                    <h3>选择行政班</h3>
                                    <hr/>
                               </div>
                          
                               <cfif rs_clazz.recordCount>
                                    
                                         <cfset row = 0 />
                                         <table class="UIEditable">
                                              <thead>
                                                   <tr>
                                                        <td width="18"></td>
                                                        <td>班级</td>
                                                        <td width="80">所在校区</td>
                                                        <td width="60" align="center">计划人数</td>
                                                        <td width="40" align="center">学生数</td>
                                                        <td width="18"></td>
                                                   </tr>
                                              </thead>
                                              <tbody>
                                             <cfloop query="rs_clazz">
                                                             <cfset structInsert(passArgs, "CLSID", rs_clazz.cls_id, true) />
                                                             <cfset structInsert(passArgs, "grade", rs_clazz.grade, true) />
                                                             <cfset row++ />
                                                             <tr class="editRows <cfif rs_clazz.cls_size lt rs_clazz.cls_scale>noticeRow1</cfif>">
                                                                  <td class="index"><cfoutput>#row#</cfoutput></td>
                                                                  <td><cfoutput>#rs_clazz.cls_name#</cfoutput></td>
                                                                  <td><cfoutput>#rs_clazz.campus_name#</cfoutput></td>
                                                                  <td align="center"><span class="numeric"><cfoutput>#rs_clazz.cls_size#</cfoutput></span></td>
                                                                  <td align="center"><span class="numeric"><cfoutput>#rs_clazz.cls_scale#</cfoutput></span></td>
                                                                  <td><a title="打印班级课表" target="_blank" class="stat print" href="<cfoutput>#buildURL('classCoursePrint', passArgs)#</cfoutput>"></a></td>
                                                             </tr>
                                                   </cfloop>
                                                   <!--- 移出班级号参数 --->
                                                   <cfset structDelete( passArgs, "CLSID", false ) />
                                              </tbody>
                                         </table>
                                    
                                    <cfelse>
                                    
                                         <div class="systemNotice">
                                              <p>该专业在指定年级没有招生</p>
                                         </div>
                                    
                               </cfif>
                          
                          </div>
					
				
				</cfif>
				
			</div>
		</li>
	</ul>
</div>
				



